home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / 88games.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  21KB  |  596 lines

  1. /***************************************************************************
  2.  
  3. 88 Games (c) 1988 Konami
  4.  
  5. ***************************************************************************/
  6.  
  7. #include "driver.h"
  8. #include "vidhrdw/generic.h"
  9. #include "cpu/konami/konami.h"
  10. #include "cpu/z80/z80.h"
  11. #include "vidhrdw/konamiic.h"
  12.  
  13.  
  14. static void k88games_init_machine( void );
  15. static void k88games_banking( int lines );
  16.  
  17. static unsigned char *ram;
  18. static int videobank;
  19.  
  20. extern int k88games_priority;
  21. int k88games_vh_start(void);
  22. void k88games_vh_stop(void);
  23. void k88games_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  24.  
  25.  
  26. static unsigned char *nvram;
  27. static size_t nvram_size;
  28.  
  29. static void nvram_handler(void *file,int read_or_write)
  30. {
  31.     if (read_or_write)
  32.         osd_fwrite(file,nvram,nvram_size);
  33.     else
  34.     {
  35.         if (file)
  36.             osd_fread(file,nvram,nvram_size);
  37.         else
  38.             memset(nvram,0,nvram_size);
  39.     }
  40. }
  41.  
  42.  
  43. static int k88games_interrupt(void)
  44. {
  45.     if (K052109_is_IRQ_enabled()) return interrupt();
  46.     else return ignore_interrupt();
  47. }
  48.  
  49. static int zoomreadroms;
  50.  
  51. static READ_HANDLER( bankedram_r )
  52. {
  53.     if (videobank) return ram[offset];
  54.     else
  55.     {
  56.         if (zoomreadroms)
  57.             return K051316_rom_0_r(offset);
  58.         else
  59.             return K051316_0_r(offset);
  60.     }
  61. }
  62.  
  63. static WRITE_HANDLER( bankedram_w )
  64. {
  65.     if (videobank) ram[offset] = data;
  66.     else K051316_0_w(offset,data);
  67. }
  68.  
  69. static WRITE_HANDLER( k88games_5f84_w )
  70. {
  71.     /* bits 0/1 coin counters */
  72.     coin_counter_w(0,data & 0x01);
  73.     coin_counter_w(1,data & 0x02);
  74.  
  75.     /* bit 2 enables ROM reading from the 051316 */
  76.     /* also 5fce == 2 read roms, == 3 read ram */
  77.     zoomreadroms = data & 0x04;
  78.  
  79.     if (data & 0xf8)
  80.     {
  81.         char buf[40];
  82.         sprintf(buf,"5f84 = %02x",data);
  83.         usrintf_showmessage(buf);
  84.     }
  85. }
  86.  
  87. static WRITE_HANDLER( k88games_sh_irqtrigger_w )
  88. {
  89.     cpu_cause_interrupt(1,0xff);
  90. }
  91.  
  92. /* handle fake button for speed cheat */
  93. static READ_HANDLER( cheat_r )
  94. {
  95.     int res;
  96.     static int cheat = 0;
  97.     static int bits[] = { 0xee, 0xff, 0xbb, 0xaa };
  98.  
  99.     res = readinputport(1);
  100.  
  101.     if ((readinputport(0) & 0x08) == 0)
  102.     {
  103.         res |= 0x55;
  104.         res &= bits[cheat];
  105.         cheat = (++cheat)%4;
  106.     }
  107.     return res;
  108. }
  109.  
  110. static int speech_chip;
  111. static int invalid_code;
  112. static int total_samples[] = { 0x39, 0x15 };
  113.  
  114. static WRITE_HANDLER( speech_control_w )
  115. {
  116.     int reset = ( ( data >> 1 ) & 1 );
  117.     int start = ( ~data ) & 1;
  118.  
  119.     speech_chip = ( data & 4 ) ? 1 : 0;
  120.  
  121.     UPD7759_reset_w( speech_chip, reset );
  122.  
  123.     if (!invalid_code)
  124.         UPD7759_start_w( speech_chip, start );
  125. }
  126.  
  127. static WRITE_HANDLER( speech_msg_w )
  128. {
  129.     UPD7759_message_w( speech_chip, data );
  130.     invalid_code = (data == total_samples[speech_chip]);
  131. }
  132.  
  133. static struct MemoryReadAddress readmem[] =
  134. {
  135.     { 0x0000, 0x1fff, MRA_RAM },    /* banked ROM + palette RAM */
  136.     { 0x2000, 0x37ff, MRA_RAM },
  137.     { 0x3800, 0x3fff, bankedram_r },
  138.     { 0x5f94, 0x5f94, input_port_0_r },
  139. //    { 0x5f95, 0x5f95, input_port_1_r },
  140.     { 0x5f95, 0x5f95, cheat_r },    /* P1 IO and handle fake button for cheating */
  141.     { 0x5f96, 0x5f96, input_port_2_r },
  142.     { 0x5f97, 0x5f97, input_port_3_r },
  143.     { 0x5f9b, 0x5f9b, input_port_4_r },
  144.     { 0x4000, 0x7fff, K052109_051960_r },
  145.     { 0x8000, 0xffff, MRA_ROM },
  146.     { -1 }    /* end of table */
  147. };
  148.  
  149. static struct MemoryWriteAddress writemem[] =
  150. {
  151.     { 0x0000, 0x0fff, MWA_RAM },    /* banked ROM */
  152.     { 0x1000, 0x1fff, paletteram_xBBBBBGGGGGRRRRR_swap_w, &paletteram },    /* banked ROM + palette RAM */
  153.     { 0x2000, 0x2fff, MWA_RAM },
  154.     { 0x3000, 0x37ff, MWA_RAM, &nvram, &nvram_size },
  155.     { 0x3800, 0x3fff, bankedram_w, &ram },
  156.     { 0x5f84, 0x5f84, k88games_5f84_w },
  157.     { 0x5f88, 0x5f88, watchdog_reset_w },
  158.     { 0x5f8c, 0x5f8c, soundlatch_w },
  159.     { 0x5f90, 0x5f90, k88games_sh_irqtrigger_w },
  160.     { 0x5fc0, 0x5fcf, K051316_ctrl_0_w },
  161.     { 0x4000, 0x7fff, K052109_051960_w },
  162.     { 0x8000, 0xffff, MWA_ROM },
  163.     { -1 }    /* end of table */
  164. };
  165.  
  166. static struct MemoryReadAddress sound_readmem[] =
  167. {
  168.     { 0x0000, 0x7fff, MRA_ROM },
  169.     { 0x8000, 0x87ff, MRA_RAM },
  170.     { 0xa000, 0xa000, soundlatch_r },
  171.     { 0xc001, 0xc001, YM2151_status_port_0_r },
  172.     { -1 }    /* end of table */
  173. };
  174.  
  175. static struct MemoryWriteAddress sound_writemem[] =
  176. {
  177.     { 0x0000, 0x7fff, MWA_ROM },
  178.     { 0x8000, 0x87ff, MWA_RAM },
  179.     { 0x9000, 0x9000, speech_msg_w },
  180.     { 0xc000, 0xc000, YM2151_register_port_0_w },
  181.     { 0xc001, 0xc001, YM2151_data_port_0_w },
  182.     { 0xe000, 0xe000, speech_control_w },
  183.     { -1 }    /* end of table */
  184. };
  185.  
  186.  
  187.  
  188. /***************************************************************************
  189.  
  190.     Input Ports
  191.  
  192. ***************************************************************************/
  193.  
  194. INPUT_PORTS_START( 88games )
  195.     PORT_START
  196.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  197.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  198.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  199. //    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  200.     /* Fake button to press buttons 1 and 3 impossibly fast. Handle via konami_IN1_r */
  201.     PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_CHEAT | IPF_PLAYER1, "Run Like Hell Cheat", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  202.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) )
  203.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  204.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  205.     PORT_DIPNAME( 0x20, 0x20, "World Records" )
  206.     PORT_DIPSETTING(    0x20, "Don't Erase" )
  207.     PORT_DIPSETTING(    0x00, "Erase on Reset" )
  208.     PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
  209.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  210.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  211.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  212.  
  213.     PORT_START
  214.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  215.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  216.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
  217.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  218.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  219.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  220.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  221.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  222.  
  223.     PORT_START
  224.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  225.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  226.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  227.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 )
  228.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
  229.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
  230.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
  231.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
  232.  
  233.     PORT_START
  234.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  235.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  236.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  237.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  238.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  239.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  240.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  241.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  242.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  243.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  244.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  245.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  246.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  247.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  248.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  249.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  250.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  251.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  252.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  253.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  254.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  255.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  256.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  257.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  258.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  259.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  260.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  261.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  262.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  263.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  264.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  265.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  266.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  267. //    PORT_DIPSETTING(    0x00, "Disabled" )
  268.  
  269.     PORT_START
  270.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  271.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  272.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  273.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  274.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  275.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  276.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  277.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  278.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  279.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  280.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  281.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  282.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  283.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  284.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  285.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  286.     PORT_DIPSETTING(    0x60, "Easy" )
  287.     PORT_DIPSETTING(    0x40, "Normal" )
  288.     PORT_DIPSETTING(    0x20, "Hard" )
  289.     PORT_DIPSETTING(    0x00, "Hardest" )
  290.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  291.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  292.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  293. INPUT_PORTS_END
  294.  
  295.  
  296.  
  297. static struct YM2151interface ym2151_interface =
  298. {
  299.     1,            /* 1 chip */
  300.     3579545,    /* 3.579545 MHz */
  301.     { YM3012_VOL(75,MIXER_PAN_LEFT,75,MIXER_PAN_RIGHT) },
  302.     { 0 }
  303. };
  304.  
  305. static struct UPD7759_interface upd7759_interface =
  306. {
  307.     2,                            /* number of chips */
  308.     UPD7759_STANDARD_CLOCK,
  309.     { 30, 30 },                    /* volume */
  310.     { REGION_SOUND1, REGION_SOUND2 },    /* memory region */
  311.     UPD7759_STANDALONE_MODE,    /* chip mode */
  312.     {0}
  313. };
  314.  
  315.  
  316.  
  317. static struct MachineDriver machine_driver_88games =
  318. {
  319.     {
  320.         {
  321.             CPU_KONAMI,
  322.             3000000, /* ? */
  323.             readmem,writemem,0,0,
  324.             k88games_interrupt,1
  325.         },
  326.         {
  327.             CPU_Z80 | CPU_AUDIO_CPU,
  328.             3579545,
  329.             sound_readmem, sound_writemem,0,0,
  330.             ignore_interrupt,0    /* interrupts are triggered by the main CPU */
  331.         }
  332.     },
  333.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  334.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  335.     k88games_init_machine,
  336.  
  337.     /* video hardware */
  338.     64*8, 32*8, { 13*8, (64-13)*8-1, 2*8, 30*8-1 },
  339.     0,    /* gfx decoded by konamiic.c */
  340.     2048, 2048,
  341.     0,
  342.  
  343.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  344.     0,
  345.     k88games_vh_start,
  346.     k88games_vh_stop,
  347.     k88games_vh_screenrefresh,
  348.  
  349.     /* sound hardware */
  350.     0,0,0,0,
  351.     {
  352.         {
  353.             SOUND_YM2151,
  354.             &ym2151_interface
  355.         },
  356.         {
  357.             SOUND_UPD7759,
  358.             &upd7759_interface
  359.         }
  360.     },
  361.  
  362.     nvram_handler
  363. };
  364.  
  365.  
  366.  
  367. /***************************************************************************
  368.  
  369.   Game ROMs
  370.  
  371. ***************************************************************************/
  372.  
  373. ROM_START( 88games )
  374.     ROM_REGION( 0x21000, REGION_CPU1 ) /* code + banked roms + space for banked ram */
  375.     ROM_LOAD( "861m01.k18", 0x08000, 0x08000, 0x4a4e2959 )
  376.     ROM_LOAD( "861m02.k16", 0x10000, 0x10000, 0xe19f15f6 )
  377.  
  378.     ROM_REGION( 0x10000, REGION_CPU2 ) /* Z80 code */
  379.     ROM_LOAD( "861d01.d9", 0x00000, 0x08000, 0x0ff1dec0 )
  380.  
  381.     ROM_REGION( 0x080000, REGION_GFX1 ) /* graphics ( dont dispose as the program can read them ) */
  382.     ROM_LOAD_GFX_EVEN( "861a08.a", 0x000000, 0x10000, 0x77a00dd6 )    /* characters */
  383.     ROM_LOAD_GFX_ODD ( "861a08.c", 0x000000, 0x10000, 0xb422edfc )
  384.     ROM_LOAD_GFX_EVEN( "861a08.b", 0x020000, 0x10000, 0x28a8304f )
  385.     ROM_LOAD_GFX_ODD ( "861a08.d", 0x020000, 0x10000, 0xe01a3802 )
  386.     ROM_LOAD_GFX_EVEN( "861a09.a", 0x040000, 0x10000, 0xdf8917b6 )
  387.     ROM_LOAD_GFX_ODD ( "861a09.c", 0x040000, 0x10000, 0xf577b88f )
  388.     ROM_LOAD_GFX_EVEN( "861a09.b", 0x060000, 0x10000, 0x4917158d )
  389.     ROM_LOAD_GFX_ODD ( "861a09.d", 0x060000, 0x10000, 0x2bb3282c )
  390.  
  391.     ROM_REGION( 0x100000, REGION_GFX2 ) /* graphics ( dont dispose as the program can read them ) */
  392.     ROM_LOAD_GFX_EVEN( "861a05.a", 0x000000, 0x10000, 0xcedc19d0 )    /* sprites */
  393.     ROM_LOAD_GFX_ODD ( "861a05.e", 0x000000, 0x10000, 0x725af3fc )
  394.     ROM_LOAD_GFX_EVEN( "861a05.b", 0x020000, 0x10000, 0xdb2a8808 )
  395.     ROM_LOAD_GFX_ODD ( "861a05.f", 0x020000, 0x10000, 0x32d830ca )
  396.     ROM_LOAD_GFX_EVEN( "861a05.c", 0x040000, 0x10000, 0xcf03c449 )
  397.     ROM_LOAD_GFX_ODD ( "861a05.g", 0x040000, 0x10000, 0xfd51c4ea )
  398.     ROM_LOAD_GFX_EVEN( "861a05.d", 0x060000, 0x10000, 0x97d78c77 )
  399.     ROM_LOAD_GFX_ODD ( "861a05.h", 0x060000, 0x10000, 0x60d0c8a5 )
  400.     ROM_LOAD_GFX_EVEN( "861a06.a", 0x080000, 0x10000, 0x85e2e30e )
  401.     ROM_LOAD_GFX_ODD ( "861a06.e", 0x080000, 0x10000, 0x6f96651c )
  402.     ROM_LOAD_GFX_EVEN( "861a06.b", 0x0a0000, 0x10000, 0xce17eaf0 )
  403.     ROM_LOAD_GFX_ODD ( "861a06.f", 0x0a0000, 0x10000, 0x88310bf3 )
  404.     ROM_LOAD_GFX_EVEN( "861a06.c", 0x0c0000, 0x10000, 0xa568b34e )
  405.     ROM_LOAD_GFX_ODD ( "861a06.g", 0x0c0000, 0x10000, 0x4a55beb3 )
  406.     ROM_LOAD_GFX_EVEN( "861a06.d", 0x0e0000, 0x10000, 0xbc70ab39 )
  407.     ROM_LOAD_GFX_ODD ( "861a06.h", 0x0e0000, 0x10000, 0xd906b79b )
  408.  
  409.     ROM_REGION( 0x040000, REGION_GFX3 ) /* graphics ( dont dispose as the program can read them ) */
  410.     ROM_LOAD( "861a04.a", 0x000000, 0x10000, 0x092a8b15 )    /* zoom/rotate */
  411.     ROM_LOAD( "861a04.b", 0x010000, 0x10000, 0x75744b56 )
  412.     ROM_LOAD( "861a04.c", 0x020000, 0x10000, 0xa00021c5 )
  413.     ROM_LOAD( "861a04.d", 0x030000, 0x10000, 0xd208304c )
  414.  
  415.     ROM_REGION( 0x0100, REGION_PROMS )
  416.     ROM_LOAD( "861.g3",   0x0000, 0x0100, 0x429785db )    /* priority encoder (not used) */
  417.  
  418.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples for UPD7759 #0 */
  419.     ROM_LOAD( "861a07.a", 0x000000, 0x10000, 0x5d035d69 )
  420.     ROM_LOAD( "861a07.b", 0x010000, 0x10000, 0x6337dd91 )
  421.  
  422.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples for UPD7759 #1 */
  423.     ROM_LOAD( "861a07.c", 0x000000, 0x10000, 0x5067a38b )
  424.     ROM_LOAD( "861a07.d", 0x010000, 0x10000, 0x86731451 )
  425. ROM_END
  426.  
  427. ROM_START( konami88 )
  428.     ROM_REGION( 0x21000, REGION_CPU1 ) /* code + banked roms + space for banked ram */
  429.     ROM_LOAD( "861.e03", 0x08000, 0x08000, 0x55979bd9 )
  430.     ROM_LOAD( "861.e02", 0x10000, 0x10000, 0x5b7e98a6 )
  431.  
  432.     ROM_REGION( 0x10000, REGION_CPU2 ) /* Z80 code */
  433.     ROM_LOAD( "861d01.d9", 0x00000, 0x08000, 0x0ff1dec0 )
  434.  
  435.     ROM_REGION(  0x080000, REGION_GFX1 ) /* graphics ( dont dispose as the program can read them ) */
  436.     ROM_LOAD_GFX_EVEN( "861a08.a", 0x000000, 0x10000, 0x77a00dd6 )    /* characters */
  437.     ROM_LOAD_GFX_ODD ( "861a08.c", 0x000000, 0x10000, 0xb422edfc )
  438.     ROM_LOAD_GFX_EVEN( "861a08.b", 0x020000, 0x10000, 0x28a8304f )
  439.     ROM_LOAD_GFX_ODD ( "861a08.d", 0x020000, 0x10000, 0xe01a3802 )
  440.     ROM_LOAD_GFX_EVEN( "861a09.a", 0x040000, 0x10000, 0xdf8917b6 )
  441.     ROM_LOAD_GFX_ODD ( "861a09.c", 0x040000, 0x10000, 0xf577b88f )
  442.     ROM_LOAD_GFX_EVEN( "861a09.b", 0x060000, 0x10000, 0x4917158d )
  443.     ROM_LOAD_GFX_ODD ( "861a09.d", 0x060000, 0x10000, 0x2bb3282c )
  444.  
  445.     ROM_REGION( 0x100000, REGION_GFX2 ) /* graphics ( dont dispose as the program can read them ) */
  446.     ROM_LOAD_GFX_EVEN( "861a05.a", 0x000000, 0x10000, 0xcedc19d0 )    /* sprites */
  447.     ROM_LOAD_GFX_ODD ( "861a05.e", 0x000000, 0x10000, 0x725af3fc )
  448.     ROM_LOAD_GFX_EVEN( "861a05.b", 0x020000, 0x10000, 0xdb2a8808 )
  449.     ROM_LOAD_GFX_ODD ( "861a05.f", 0x020000, 0x10000, 0x32d830ca )
  450.     ROM_LOAD_GFX_EVEN( "861a05.c", 0x040000, 0x10000, 0xcf03c449 )
  451.     ROM_LOAD_GFX_ODD ( "861a05.g", 0x040000, 0x10000, 0xfd51c4ea )
  452.     ROM_LOAD_GFX_EVEN( "861a05.d", 0x060000, 0x10000, 0x97d78c77 )
  453.     ROM_LOAD_GFX_ODD ( "861a05.h", 0x060000, 0x10000, 0x60d0c8a5 )
  454.     ROM_LOAD_GFX_EVEN( "861a06.a", 0x080000, 0x10000, 0x85e2e30e )
  455.     ROM_LOAD_GFX_ODD ( "861a06.e", 0x080000, 0x10000, 0x6f96651c )
  456.     ROM_LOAD_GFX_EVEN( "861a06.b", 0x0a0000, 0x10000, 0xce17eaf0 )
  457.     ROM_LOAD_GFX_ODD ( "861a06.f", 0x0a0000, 0x10000, 0x88310bf3 )
  458.     ROM_LOAD_GFX_EVEN( "861a06.c", 0x0c0000, 0x10000, 0xa568b34e )
  459.     ROM_LOAD_GFX_ODD ( "861a06.g", 0x0c0000, 0x10000, 0x4a55beb3 )
  460.     ROM_LOAD_GFX_EVEN( "861a06.d", 0x0e0000, 0x10000, 0xbc70ab39 )
  461.     ROM_LOAD_GFX_ODD ( "861a06.h", 0x0e0000, 0x10000, 0xd906b79b )
  462.  
  463.     ROM_REGION( 0x040000, REGION_GFX3 ) /* graphics ( dont dispose as the program can read them ) */
  464.     ROM_LOAD( "861a04.a", 0x000000, 0x10000, 0x092a8b15 )    /* zoom/rotate */
  465.     ROM_LOAD( "861a04.b", 0x010000, 0x10000, 0x75744b56 )
  466.     ROM_LOAD( "861a04.c", 0x020000, 0x10000, 0xa00021c5 )
  467.     ROM_LOAD( "861a04.d", 0x030000, 0x10000, 0xd208304c )
  468.  
  469.     ROM_REGION( 0x0100, REGION_PROMS )
  470.     ROM_LOAD( "861.g3",   0x0000, 0x0100, 0x429785db )    /* priority encoder (not used) */
  471.  
  472.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples for UPD7759 #0 */
  473.     ROM_LOAD( "861a07.a", 0x000000, 0x10000, 0x5d035d69 )
  474.     ROM_LOAD( "861a07.b", 0x010000, 0x10000, 0x6337dd91 )
  475.  
  476.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples for UPD7759 #1 */
  477.     ROM_LOAD( "861a07.c", 0x000000, 0x10000, 0x5067a38b )
  478.     ROM_LOAD( "861a07.d", 0x010000, 0x10000, 0x86731451 )
  479. ROM_END
  480.  
  481. ROM_START( hypsptsp )
  482.     ROM_REGION( 0x21000, REGION_CPU1 ) /* code + banked roms + space for banked ram */
  483.     ROM_LOAD( "861f03.k18", 0x08000, 0x08000, 0x8c61aebd )
  484.     ROM_LOAD( "861f02.k16", 0x10000, 0x10000, 0xd2460c28 )
  485.  
  486.     ROM_REGION( 0x10000, REGION_CPU2 ) /* Z80 code */
  487.     ROM_LOAD( "861d01.d9", 0x00000, 0x08000, 0x0ff1dec0 )
  488.  
  489.     ROM_REGION(  0x080000, REGION_GFX1 ) /* graphics ( dont dispose as the program can read them ) */
  490.     ROM_LOAD_GFX_EVEN( "861a08.a", 0x000000, 0x10000, 0x77a00dd6 )    /* characters */
  491.     ROM_LOAD_GFX_ODD ( "861a08.c", 0x000000, 0x10000, 0xb422edfc )
  492.     ROM_LOAD_GFX_EVEN( "861a08.b", 0x020000, 0x10000, 0x28a8304f )
  493.     ROM_LOAD_GFX_ODD ( "861a08.d", 0x020000, 0x10000, 0xe01a3802 )
  494.     ROM_LOAD_GFX_EVEN( "861a09.a", 0x040000, 0x10000, 0xdf8917b6 )
  495.     ROM_LOAD_GFX_ODD ( "861a09.c", 0x040000, 0x10000, 0xf577b88f )
  496.     ROM_LOAD_GFX_EVEN( "861a09.b", 0x060000, 0x10000, 0x4917158d )
  497.     ROM_LOAD_GFX_ODD ( "861a09.d", 0x060000, 0x10000, 0x2bb3282c )
  498.  
  499.     ROM_REGION( 0x100000, REGION_GFX2 ) /* graphics ( dont dispose as the program can read them ) */
  500.     ROM_LOAD_GFX_EVEN( "861a05.a", 0x000000, 0x10000, 0xcedc19d0 )    /* sprites */
  501.     ROM_LOAD_GFX_ODD ( "861a05.e", 0x000000, 0x10000, 0x725af3fc )
  502.     ROM_LOAD_GFX_EVEN( "861a05.b", 0x020000, 0x10000, 0xdb2a8808 )
  503.     ROM_LOAD_GFX_ODD ( "861a05.f", 0x020000, 0x10000, 0x32d830ca )
  504.     ROM_LOAD_GFX_EVEN( "861a05.c", 0x040000, 0x10000, 0xcf03c449 )
  505.     ROM_LOAD_GFX_ODD ( "861a05.g", 0x040000, 0x10000, 0xfd51c4ea )
  506.     ROM_LOAD_GFX_EVEN( "861a05.d", 0x060000, 0x10000, 0x97d78c77 )
  507.     ROM_LOAD_GFX_ODD ( "861a05.h", 0x060000, 0x10000, 0x60d0c8a5 )
  508.     ROM_LOAD_GFX_EVEN( "861a06.a", 0x080000, 0x10000, 0x85e2e30e )
  509.     ROM_LOAD_GFX_ODD ( "861a06.e", 0x080000, 0x10000, 0x6f96651c )
  510.     ROM_LOAD_GFX_EVEN( "861a06.b", 0x0a0000, 0x10000, 0xce17eaf0 )
  511.     ROM_LOAD_GFX_ODD ( "861a06.f", 0x0a0000, 0x10000, 0x88310bf3 )
  512.     ROM_LOAD_GFX_EVEN( "861a06.c", 0x0c0000, 0x10000, 0xa568b34e )
  513.     ROM_LOAD_GFX_ODD ( "861a06.g", 0x0c0000, 0x10000, 0x4a55beb3 )
  514.     ROM_LOAD_GFX_EVEN( "861a06.d", 0x0e0000, 0x10000, 0xbc70ab39 )
  515.     ROM_LOAD_GFX_ODD ( "861a06.h", 0x0e0000, 0x10000, 0xd906b79b )
  516.  
  517.     ROM_REGION( 0x040000, REGION_GFX3 ) /* graphics ( dont dispose as the program can read them ) */
  518.     ROM_LOAD( "861a04.a", 0x000000, 0x10000, 0x092a8b15 )    /* zoom/rotate */
  519.     ROM_LOAD( "861a04.b", 0x010000, 0x10000, 0x75744b56 )
  520.     ROM_LOAD( "861a04.c", 0x020000, 0x10000, 0xa00021c5 )
  521.     ROM_LOAD( "861a04.d", 0x030000, 0x10000, 0xd208304c )
  522.  
  523.     ROM_REGION( 0x0100, REGION_PROMS )
  524.     ROM_LOAD( "861.g3",   0x0000, 0x0100, 0x429785db )    /* priority encoder (not used) */
  525.  
  526.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* samples for UPD7759 #0 */
  527.     ROM_LOAD( "861a07.a", 0x000000, 0x10000, 0x5d035d69 )
  528.     ROM_LOAD( "861a07.b", 0x010000, 0x10000, 0x6337dd91 )
  529.  
  530.     ROM_REGION( 0x20000, REGION_SOUND2 ) /* samples for UPD7759 #1 */
  531.     ROM_LOAD( "861a07.c", 0x000000, 0x10000, 0x5067a38b )
  532.     ROM_LOAD( "861a07.d", 0x010000, 0x10000, 0x86731451 )
  533. ROM_END
  534.  
  535.  
  536.  
  537. static void k88games_banking( int lines )
  538. {
  539.     unsigned char *RAM = memory_region(REGION_CPU1);
  540.     int offs;
  541.  
  542. logerror("%04x: bank select %02x\n",cpu_get_pc(),lines);
  543.  
  544.     /* bits 0-2 select ROM bank for 0000-1fff */
  545.     /* bit 3: when 1, palette RAM at 1000-1fff */
  546.     /* bit 4: when 0, 051316 RAM at 3800-3fff; when 1, work RAM at 2000-3fff (NVRAM 3370-37ff) */
  547.     offs = 0x10000 + (lines & 0x07) * 0x2000;
  548.     memcpy(RAM,&RAM[offs],0x1000);
  549.     if (lines & 0x08)
  550.     {
  551.         if (paletteram != &RAM[0x1000])
  552.         {
  553.             memcpy(&RAM[0x1000],paletteram,0x1000);
  554.             paletteram = &RAM[0x1000];
  555.         }
  556.     }
  557.     else
  558.     {
  559.         if (paletteram != &RAM[0x20000])
  560.         {
  561.             memcpy(&RAM[0x20000],paletteram,0x1000);
  562.             paletteram = &RAM[0x20000];
  563.         }
  564.         memcpy(&RAM[0x1000],&RAM[offs+0x1000],0x1000);
  565.     }
  566.     videobank = lines & 0x10;
  567.  
  568.     /* bit 5 = enable char ROM reading through the video RAM */
  569.     K052109_set_RMRD_line((lines & 0x20) ? ASSERT_LINE : CLEAR_LINE);
  570.  
  571.     /* bit 6 is unknown, 1 most of the time */
  572.  
  573.     /* bit 7 controls layer priority */
  574.     k88games_priority = lines & 0x80;
  575. }
  576.  
  577. static void k88games_init_machine( void )
  578. {
  579.     konami_cpu_setlines_callback = k88games_banking;
  580.     paletteram = &memory_region(REGION_CPU1)[0x20000];
  581. }
  582.  
  583.  
  584.  
  585. static void init_88games(void)
  586. {
  587.     konami_rom_deinterleave_2(REGION_GFX1);
  588.     konami_rom_deinterleave_2(REGION_GFX2);
  589. }
  590.  
  591.  
  592.  
  593. GAME( 1988, 88games,  0,       88games, 88games, 88games, ROT0, "Konami", "'88 Games" )
  594. GAME( 1988, konami88, 88games, 88games, 88games, 88games, ROT0, "Konami", "Konami '88" )
  595. GAME( 1988, hypsptsp, 88games, 88games, 88games, 88games, ROT0, "Konami", "Hyper Sports Special (Japan)" )
  596.